// Copyright (C) 2010 Félix Cloutier.

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License 2.0 for more details.

// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/

#include "JitRecompiler.h"

#define INST(name) \
	void JitRecompiler::name(UGeckoInstruction inst, JitFunctionContext& functionContext)

namespace LLVMJit
{

INST(lbz)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lbzu)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lfd)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lfdu)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lfs)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lfsu)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lha)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lhau)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lhz)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lhzu)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lmw)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lwz)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lwzu)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stb)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stbu)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stfd)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stfdu)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stfs)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stfsu)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(sth)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(sthu)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stmw)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stw)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stwu)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(dcba)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(dcbf)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(dcbi)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(dcbst)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(dcbt)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(dcbtst)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(dcbz)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(eciwx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(ecowx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(eieio)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(icbi)
{
	llvm::IRBuilder<>& builder = functionContext.GetBuilder();
	
	llvm::Value* address = LoadGReg(builder, inst.RB);
	if (inst.RA)
	{
		llvm::Value* ra = LoadGReg(builder, inst.RA);
		address = builder.CreateAdd(address, ra);
	}
	
	llvm::Function* invalidateCache = bindings->GetBinding(JitBindings::InvalidateInstructionCache);
	builder.CreateCall2(invalidateCache, functionContext.GetJitExecutor(), address);
}

INST(lbzux)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lbzx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lfdux)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lfdx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lfsux)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lfsx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lhaux)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lhax)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lhbrx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lhzux)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lhzx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lswi)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lswx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lwarx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lwbrx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lwzux)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(lwzx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stbux)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stbx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stfdux)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stfdx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stfiwx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stfsux)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stfsx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(sthbrx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(sthux)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(sthx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stswi)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stswx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stwbrx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stwcxd)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stwux)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(stwx)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(sync)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(tlbia)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(tlbie)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

INST(tlbsync)
{
#ifndef _MSC_VER
#warning	Implement me!
#endif
	Default(inst, functionContext);
}

}
